package com.zhejiangzhengyuan.municipal_security.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhejiangzhengyuan.municipal_common.entity.BusinessLog;
import com.zhejiangzhengyuan.municipal_common.mapper.BusinessLogMapper;
import com.zhejiangzhengyuan.municipal_common.response.ResponseVo;
import com.zhejiangzhengyuan.municipal_common.utils.ConstantUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lin_ju
 * Create on 2019/12/29
 */
@RestController
@Api(tags = "系统日志")
@RequestMapping("/security/systemLog")
public class SystemLogController {

    @Autowired
    BusinessLogMapper businessLogMapper;


    @ApiOperation("系统日志查询")
    @RequestMapping(value = "/selectBusinessLog", method = RequestMethod.GET)
    public ResponseVo selectAllBusinessLogPage(@ApiParam("页码") Long page, @ApiParam("每页显示条数") Long limit) {
        // pageNo默认为1；size默认为10
        page = page == null || page <= 0 ? 1 : page;
        limit = limit == null || limit <= 0 ? 11 : limit;
        IPage<BusinessLog> businessLogPage = new Page<>(page, limit);
        IPage<BusinessLog> businessLogIPage = businessLogMapper.selectPage(businessLogPage, null);
        return new ResponseVo<>(ConstantUtil.ResultCode.SUCCESS, businessLogIPage);
    }


}
